<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<body>
<p>小说名:<input type="text" name="fictionName" id="document"/></p>
<button id = "send">搜索</button>
<div>

</div>
</body>
<script>
	var fictionList = null;
    $(function(){
    $('#send').click(function(){
         $.ajax({
             type: "GET",
             url: "http://127.0.0.1:8080/fiction/q",
             data: {fictionName:$("#document").val()},
             dataType: "json",
             success: function(data){
                         $('#document').empty();   //清空resText里面的所有内容
                         var html = '';
						 this.fictionList = data;
                         // $.each(data, function(commentIndex, comment){
                         //       html += '<div class="comment"><h6>' + comment['username']
                         //                 + ':</h6><p class="para"' + comment['content']
                         //                 + '</p></div>';
                         // });
                         // $('#resText').html(html);
                      }
         });
    });
});
</script>
</html>